package com.logistics.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 运输订单实体类（收货开票）
 */
@Data
@TableName("transport_order")
public class TransportOrder {
    
    @TableId(type = IdType.AUTO)
    private Long id;
    
    private Long tenantId;
    
    private Long siteId;
    
    private String orderNo;
    
    // 货物编码
    private String goodsCode;
    
    // 站点信息
    private Long departureSiteId;
    
    private String departureSiteName;
    
    private Long arrivalSiteId;
    
    private String arrivalSiteName;
    
    // 发货信息
    private String senderName;
    
    private String senderPhone;
    
    // 收货信息
    private String receiverName;
    
    private String receiverPhone;
    
    private String deliveryType;  // 配送方式：DELIVERY-送货上门, PICKUP-到站自提
    
    private String deliveryOptions;  // 配送附加选项（逗号分隔）：SIGN_RECEIPT-签回单, PRINT_RECEIPT-打收条
    
    private String receiverAddress;  // 收货地址（送货方式时填写）
    
    // 货物信息
    private String goodsName;
    
    private String goodsPackage;
    
    private Integer goodsPieces;
    
    // 运费信息
    private BigDecimal freightAmount;  // 实收运费（发货站点从客户收取的真实运费）
    
    private BigDecimal settlementAmount;  // 结算运费（给到货站点的结算金额）
    
    private BigDecimal collectionAmount;
    
    private String paymentMethod;
    
    // 订单状态
    private String orderStatus;
    
    // 收货司机（收货开票页面分配，负责收货）
    private Long driverId;
    
    private String driverName;
    
    private String driverPhone;
    
    // 送货司机（到货管理页面分配，负责派送）
    private Long deliveryDriverId;
    
    private String deliveryDriverName;
    
    private String deliveryDriverPhone;
    
    private Long vehicleId;
    
    private String vehiclePlate;

    private LocalDateTime loadedAt;

    @JsonProperty("dispatchTime")  // 前端使用 dispatchTime
    private LocalDateTime dispatchedAt;  // 发车时间（数据库字段：dispatched_at）
    
    private LocalDateTime arrivalTime;  // 到货时间（数据库字段：arrival_time）

    private LocalDateTime assignTime;
    
    // 完成信息
    private LocalDateTime deliveryTime;
    
    // 取消信息
    private String cancelReason;
    
    private LocalDateTime cancelTime;
    
    private String remark;
    
    // 开票员信息
    private Long issuerId;
    
    private String issuerName;
    
    private Long createBy;
    
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    
    private Long updateBy;
    
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}

